package com.core.dao.mybatismysql;

import com.core.bean.CarItem;
import com.core.dao.ICarItemDao;
import com.core.utils.MybatisUtils;
import org.apache.ibatis.session.SqlSession;

public class CarItemDao implements ICarItemDao {
    @Override
    public int add(CarItem entity) throws Exception {
        SqlSession session = MybatisUtils.getSession();
        ICarItemDao mapper = session.getMapper(ICarItemDao.class);
        return mapper.add(entity);
    }

    @Override
    public int remove(String id) throws Exception {
        SqlSession session = MybatisUtils.getSession();
        ICarItemDao mapper = session.getMapper(ICarItemDao.class);
        return mapper.remove(id);
    }

    @Override
    public int modify(CarItem entity) throws Exception {
        SqlSession session = MybatisUtils.getSession();
        ICarItemDao mapper = session.getMapper(ICarItemDao.class);
        return mapper.modify(entity);
    }

    @Override
    public CarItem findEntityById(String id) throws Exception {
        SqlSession session = MybatisUtils.getSession();
        ICarItemDao mapper = session.getMapper(ICarItemDao.class);
        return mapper.findEntityById(id);
    }
}
